package cn.felord.websocket.config;

import org.springframework.web.socket.WebSocketHandler;
import org.springframework.web.socket.WebSocketMessage;

/**
 * 代理接口
 *
 * @author Dax
 * @since 19 :09  2018/7/7
 */
public interface WebSocketHandlerProxy extends WebSocketHandler {

    /**
     * Handle message.
     *
     * @param sessionId the session id
     * @param message   the message
     * @throws Exception the exception
     */
    void handleMessage(String sessionId, WebSocketMessage<?> message) throws Exception;
    /**
     * Handle json message.
     *
     * @param <T>       the type parameter
     * @param sessionId the session id
     * @param t         the t
     * @throws Exception the exception
     */
    <T> void handleJsonMessage(String sessionId, T t) throws Exception;

    /**
     * Handle json message.
     *
     * @param <T> the type parameter
     * @param t   the t
     * @throws Exception the exception
     */
    <T> void handleJsonMessage(T t) throws Exception;
}
